package edu.mtu.citizenscience.streamapplication.activity;


import java.io.IOException;

import edu.mtu.citizenscience.streamapplication.activity.main.SCLocationActivity;
import edu.mtu.citizenscience.streamapplication.activity.main.SCTutorialActivity;
import edu.mtu.citizenscience.streamapplication.activity.main.ManageReportsActivity;

import android.app.Activity;
import android.content.Intent;
import android.database.SQLException;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.Window;

/**
 * @author Bryan Becker <bcbecker@mtu.edu>
 * @copyright (c) 2013 MichiganTech <http://www.mtu.edu>
 * 
 * Main Stream Features Activity responsible for primary
 * navigation and tutorial.
 */
public class MainActivity extends Activity {

	/**
	 * Main Activity creation handler
	 * 
	 * @param   savedInstanceState - Bundle - Bundle with launch info
	 * @return	void
	 */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		//set the content view and enable the custom title
		requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
		setContentView(R.layout.activity_main);
		getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title);
	}
	
	/**
	 * onClick activity for the Tutorial button.
	 * 
	 * @param view - View - responsible for drawing UI components and event handling
	 * @return	void
	 */
	public void tutorial(View view) {
		//start a Tutorial Activity
		this.startActivity(new Intent(this, SCTutorialActivity.class));
	}
	
	/**
	 * onClick activity for the Create Report button
	 * 
	 * @param view - View - responsible for drawing UI components and event handling
	 * @return	void
	 */
	public void create(View view) {
		//start a new Location Activity since users must always fill out
		//the Location information before moving onto other views
		Intent intent = new Intent(this, SCLocationActivity.class);
		
		//tell the activity this is the first time it was created for the report
		intent.putExtra(SCLocationActivity.FIRST_TIME, true);
		this.startActivity(intent);
	}
	
	/**
	 * onClick activity for View/Edit Report button
	 * 
	 * @param view - View - responsible for drawing UI components and event handling
	 * @return	void
	 */
	public void manageSites(View view) {
		//start a new Manage Reports Activity
		this.startActivity(new Intent(this, ManageReportsActivity.class));
	}
}
